Object.defineProperty(exports, "__esModule", {
    value: !0
});

var e = require("../../utils/config"), a = require("../../utils/storage");

Component({
    properties: {},
    data: {
        myServices: [ {
            id: 0,
            name: "MyCheck",
            text: "我的体检",
            icon: "star-o",
            linkType: "navigateTo",
            noLoginUrl: "/pages/authorize/authorize?path=check",
            url: "/pages/my-link-check/my-link-check"
        }, {
            id: 1,
            name: "MyReport",
            text: "我的报告",
            icon: "records",
            linkType: "switchTab",
            noLoginUrl: "/pages/authorize/authorize?path=report",
            url: "/pages/my-link-report/my-link-report"
        }, 
        // {
        //     id: 2,
        //     name: "MyEInvoice",
        //     text: "申请开票",
        //     icon: "coupon-o",
        //     linkType: "navigateTo",
        //     noLoginUrl: "/pages/authorize/authorize?path=eInvoice",
        //     url: "/pages/webview/webview?h5=".concat(encodeURIComponent(e.h5EInvoiceUrl.replace("{0}", "../../pages/my/my")))
        // }, {
        //     id: 3,
        //     name: "MyFamily",
        //     text: "我的亲朋",
        //     icon: "friends-o",
        //     linkType: "navigateTo",
        //     noLoginUrl: "/pages/authorize/authorize?path=family",
        //     url: "/pages/my-link-family/my-link-family"
        // } 
    
    ],
        otherServices: [ {
            id: 4,
            text: "体检需知",
            icon: "bulb-o",
            linkType: "navigateTo",
            url: "../../pages/course-list/course-list?type=1"
        }, {
            id: 5,
            text: "常见问题",
            icon: "question-o",
            linkType: "navigateTo",
            url: "/pages/my-link-faq/my-link-faq"
        }, {
            id: 6,
            text: "关于我们",
            icon: "like-o",
            linkType: "navigateTo",
            url: "/pages/my-link-about-us/my-link-about-us"
        } ]
    },
    methods: {
        onServiceItemClick: function(e) {
            console.log(e.currentTarget);
            var t = this;
            t.setData({
                loading: !0
            });
            var i = e.currentTarget.dataset.item.url;
            a.isLogin() || (i = e.currentTarget.dataset.item.noLoginUrl), "redirectTo" == e.currentTarget.dataset.item.linkType ? wx.redirectTo({
                url: i,
                success: function() {
                    t.setData({
                        loading: !1
                    });
                }
            }) : "switchTab" == e.currentTarget.dataset.item.linkType ? wx.switchTab({
                url: i,
                success: function() {
                    t.setData({
                        loading: !1
                    });
                }
            }) : "reLaunch" == e.currentTarget.dataset.item.linkType ? wx.reLaunch({
                url: i,
                success: function() {
                    t.setData({
                        loading: !1
                    });
                }
            }) : wx.navigateTo({
                url: i,
                success: function() {
                    t.setData({
                        loading: !1
                    });
                }
            });
        },
        onServiceClick: function(t) {
            if (a.isLogin()) {
                if ("MyCheck" == t.currentTarget.id && wx.navigateTo({
                    url: "/pages/my-link-check/my-link-check"
                }), "MyReport" == t.currentTarget.id && wx.switchTab({
                    url: "/pages/my-link-report/my-link-report"
                }), "MyRefund" == t.currentTarget.id && wx.navigateTo({
                    url: "/pages/my-link-refund/my-link-refund"
                }), "MyEInvoice" == t.currentTarget.id) (i = this).setData({
                    loading: !0
                }), e.getH5EInvoiceUrl().then(function(e) {
                    var a = e;
                    a = a.replace("{0}", "../../pages/my/my"), wx.navigateTo({
                        url: "/pages/webview/webview?h5=".concat(encodeURIComponent(a)),
                        success: function() {
                            i.setData({
                                loading: !1
                            });
                        }
                    });
                });
                if ("NewMyEInvoice" == t.currentTarget.id) {
                    var i = this, r = "".concat(e.h5InvoiceUrl, "?insCode=2&source=applet&userId=").concat(a.getStorageSync(a.storageKey.uid), "&showNavBar=false");
                    wx.navigateTo({
                        url: "/pages/webview/webview?h5=".concat(encodeURIComponent(r)),
                        success: function() {
                            i.setData({
                                loading: !1
                            });
                        }
                    });
                } else "MyFamily" == t.currentTarget.id ? wx.navigateTo({
                    url: "/pages/my-link-family/my-link-family"
                }) : "MyAddress" == t.currentTarget.id && wx.navigateTo({
                    url: "/pages/my-link-address/my-link-address"
                });
            } else "MyCheck" == t.currentTarget.id && wx.navigateTo({
                url: "/pages/authorize/authorize?path=check"
            }), "MyReport" == t.currentTarget.id && wx.navigateTo({
                url: "/pages/authorize/authorize?path=report"
            }), "MyRefund" == t.currentTarget.id && wx.navigateTo({
                url: "/pages/authorize/authorize?path=refund"
            }), "MyEInvoice" == t.currentTarget.id && wx.navigateTo({
                url: "/pages/authorize/authorize?path=eInvoice"
            }), "NewMyEInvoice" == t.currentTarget.id ? wx.navigateTo({
                url: "/pages/authorize/authorize?path=eInvoice"
            }) : "MyFamily" == t.currentTarget.id ? wx.navigateTo({
                url: "/pages/authorize/authorize?path=family"
            }) : "MyAddress" == t.currentTarget.id && wx.navigateTo({
                url: "/pages/authorize/authorize?path=address"
            });
        }
    }
});